<?php
class Errors {

	var $ErrorNo;
	var $ErrorText;
		
	function Errors(){
		$settings = &getService('GlobalSettings');
		
		$link = mysql_connect($settings->get('db_host'), $settings->get('db_username'), $settings->get('db_password'));
		mysql_select_db($settings->get('db_name'), $link) or die(mysql_error());
		
		$query = "select * from errors";
		$res = mysql_query($query) or die(mysql_error());
		$i = 0;
		
		while ($row=mysql_fetch_array($res)){
			$this->ErrorNo[$i] = $row["e_id"];
			$this->ErrorText[$i] = $row["e_text"];
			$i++;
		}		
		mysql_close($link);
	}	
	
	function GetError($id){	
		for($i = 0; $i < count($this->ErrorNo); $i++){
			if($this->ErrorNo[$i] == $id) return $this->ErrorText[$i];
		}
	}
}
?>